-
Notifications
You must be signed in to change notification settings - Fork 9
Increased TSM-buffer size to 16 MiB #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Increased TSM-buffer size to 16 MiB #27
Conversation
The TSM-buffer size was increased to 16 MiB. As a consquence of this the TSM buffer has to be allocated on the heap for ltsmc.c and common.c to prevent segmentation faults.
ChristianTackeGSI
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
ChristianTackeGSI
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for now. :-)
I assume this was tested somewhat?
| int rc_minor; | ||
|
|
||
| rc_minor = fclose(file); | ||
| if (rc_minor) { | ||
| rc_minor = -errno; | ||
| CT_ERROR(rc_minor, "fclose failed on '%s'", filename); | ||
| if (buf) free(buf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move the if (buf) free(buf); above the int rc_minor;?
Something like this?
if (buf) free(buf);
buf = NULL;
int rc_minor = fclose(file);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concerns were raised in private that this could clobber some return values / errno. I appreciate the thoughtfulness about errno preservation in general.
Well.
-
The free() function returns no value, and preserves errno.
(from "man 3 free" on my Linux System)
If anyone has a reference to an implementation or documentation indicating that
free()can modify errno, please share it. -
The
free()is just below the while loop.- What errno should it clobber there? By
feof()? Well according to my manpages, it does not set errno either. - The
fclose()(where we want to preserveerrno!) is just below thefree().
- What errno should it clobber there? By
The TSM-buffer size was increased to 16 MiB. As a consquence of this the TSM buffer has to be allocated on the heap for ltsmc.c and common.c to prevent segmentation faults.